﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using Xunit;
using System.Linq.Expressions;
using System.Reflection;

namespace Eazy.Test
{
    public class LazyBuilderTest
    {
        [Fact]
        public void LazyLoading()
        {
            var lazyBuilder = LazyBuilder.Create<LazyTypeTestClass>();
            var instance = lazyBuilder.Instance;

            int count = 0;
            instance.NonVirtualProperty = count;
            lazyBuilder.Setup(c => c.VirtualProperty, () => count);
            count = 10;

            Assert.Equal(0, instance.NonVirtualProperty);
            Assert.Equal(10, instance.VirtualProperty);

            count = 100;
            Assert.Equal(10, instance.VirtualProperty);
        }
    }
}
